home *** CD-ROM | disk | FTP | other *** search
- /*
- ==============================================================================
- WordUp Graphics Toolkit Version 5.0
- Demonstration Program 37
-
- Demonstrates the use of msetxy. Press a button to end the program.
-
- *** PROJECT ***
- This program requires the file WGT5_WC.LIB to be linked. ║
-
- *** DATA FILES ***
- None.
- WATCOM C++ VERSION
- ==============================================================================
- */
-
- #include <wgt5.h>
-
- short x = 160;
- short y = 100;
- short xdir = 1;
- short ydir = 1;
- short oldmode;
-
- void main(void)
- {
- if ( !vgadetected () )
- {
- printf("Error - VGA card required for any WGT program.\n");
- exit (0);
- }
-
- printf ("WGT Example #37\n\n");
- printf ("Try struggling with the mouse to control where it moves.\n");
- printf ("MSETXY is used to force the cursor's position as it bounces around the screen.\n");
- printf ("Click the mouse button to end the program.\n");
- printf ("\n\nPress any key to continue.\n");
- getch ();
-
- oldmode = wgetmode (); /* Gets the current mode */
- vga256 (); /* Initialize graphics mode */
-
- minit ();
- mon ();
-
- do {
- x += xdir;
- y += ydir;
- if (x < 1)
- xdir = 1;
- else if (x > 318)
- xdir = -1;
-
- if (y < 1)
- ydir = 1;
- else if (y > 198)
- ydir = -1;
-
- msetxy(x,y);
- wretrace ();
- } while (!mouse.but);
- mdeinit (); /* Deinitialize the mouse handler */
-
- wsetmode (oldmode);
- }
-
-